<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        .div {
            width: 100px;
            height: 100px;
            background-color: lightsalmon;
            /*定位+margin*/
            /* position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            margin: auto; */

            /* 定位+transform */
            /* position: absolute;
            top:50%;
            left:50%;
            transform: translate(-50%, -50%); */

            /* 弹性盒 */
            /* display: flex;
            justify-content: center;
            align-items: center; */

            /* 定位+margin负值 */
            position: absolute;
            top: 50%;
            left: 50%;
            margin-top: -50px;
            margin-left: -50px;
        }
    </style>
</head>

<body>
    <div class="div"></div>
</body>

</html>